//****************************************************************************
// chainparser.h
// contains the declarations and defenitions of the ChainParser class
//
// Author: Einat Zuker
//****************************************************************************
#ifndef CHAINPARSER_H
#define CHAINPARSER_H

#include <fstream>
#include <list>
#include <vector>
#include <string>
#include <iostream>

using std::streampos;
using std::ifstream;
using std::list;
using std::vector;
using std::string;
using std::exception;

//****************************************************************************
// defines and constants
//****************************************************************************
#define LARGE_BUFFER_SIZE 256
#define SMALL_BUFFER_SIZE 64
#define MAX_BINARY_WORD_LENGTH 14

/*****************************************************************************/
// ChainParserExepetion
// implements the Chain Parser Exepetion interface
/*****************************************************************************/
class ChainParserExepetion : public exception
{
private:
	string m_ErrorDescription;
	
public:
	ChainParserExepetion(string description)
	{
		exception::exception();
		m_ErrorDescription = description;	
	}

	string GetErrorDescription()
	{
		return m_ErrorDescription;
	}
};

//*****************************************************************************
// ChainParser
// A class to define the Chain Parser interface
//*****************************************************************************
class ChainParser
{
public:
	ChainParser(string fileName);
	~ChainParser();
	int GetBinaryWordLength();
	int GetBinaryWordWeight();
	int GetNumberOfGroups();
	vector<bool> *GetFirstVertex(int groupId);
	vector<bool> *GetNextVertex();
	int* GetGroupSummary();

private:
	ifstream  m_File;
	int m_FirstGroupPos;
	int	m_BinaryWordLength;
	int m_BinaryWordWeight;
	int m_NumberOfGroups;
	int *m_GroupSummary;

	vector<bool>* ReadAndProcessVertexName();
};








#endif //CHAINPARSER_H

